﻿<UserControl x:Class="GSF.TimeSeries.UI.UserControls.ProtocolGroupUserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" d:DesignHeight="650" d:DesignWidth="850"
             xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:uc="clr-namespace:GSF.TimeSeries.UI.UserControls"
             xmlns:tsfBinding="clr-namespace:GSF.TimeSeries.UI.Binding;assembly=GSF.TimeSeries.UI"
             Background="Transparent">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/GSF.TimeSeries.UI.WPF;Component/Resources/CommonResource.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    
    <StackPanel>
        <Grid x:Name="GridDetailView" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="5" DataContext="{Binding Path=CurrentItem, Mode=TwoWay}" DataContextChanged="GridDetailView_DataContextChanged">
            <Grid.BindingGroup>
                <BindingGroup Name="input"/>
            </Grid.BindingGroup>
            
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            
            <!--First Row-->
            <TextBlock Grid.Row="0" Grid.Column="0" Text="Acronym"/>
            <TextBox Grid.Row="0" Grid.Column="1" Text="{tsfBinding:Column Path=Acronym}"/>
            <TextBlock Grid.Row="0" Grid.Column="2" Text="Name"/>
            <TextBox Grid.Row="0" Grid.Column="3" Text="{tsfBinding:Column Path=Name}"/>
            
            <!--Second Row-->
            <TextBlock Grid.Row="1" Grid.Column="0" Text="Type"/>
            <TextBox Grid.Row="1" Grid.Column="1" Text="{tsfBinding:Column Path=Type}"/>
            <TextBlock Grid.Row="1" Grid.Column="2" Text="Load Order"/>
            <TextBox Grid.Row="1" Grid.Column="3" Text="{tsfBinding:Column Path=LoadOrder}" Width="35"/>
            
            <!--Third Row-->
            <TextBlock Grid.Row="2" Grid.Column="0" Text="Category"/>
            <TextBox Grid.Row="2" Grid.Column="1" Text="{tsfBinding:Column Path=Category}"/>
            <TextBlock Grid.Row="2" Grid.Column="2" Text="Assembly Name"/>
            <TextBox Grid.Row="2" Grid.Column="3" Text="{tsfBinding:Column Path=AssemblyName}"/>
            
            <!--Fourth Row-->
            <TextBlock Grid.Row="3" Grid.Column="0" Text="Type Name"/>
            <TextBox Grid.Row="3" Grid.Column="1" Text="{tsfBinding:Column Path=TypeName}"/>
            
        </Grid>

        <uc:DetailViewFooterUserControl x:Name="UserControlDetailViewFooter" DeleteCommand="{Binding DeleteCommand}" ClearCommand="{Binding ClearCommand}" SaveCommand="{Binding SaveCommand}"
                SaveEnabled="{tsfBinding:DataOperation Path=(Validation.HasError)}" />

        <sdk:DataGrid x:Name="DataGridList" ItemsSource="{Binding CurrentPage}" SelectedItem="{Binding Path=CurrentItem, Mode=TwoWay}" Height="Auto" PreviewKeyDown="DataGrid_PreviewKeyDown">
            <sdk:DataGrid.Columns>
                <sdk:DataGridTextColumn Header="Acronym" Width="*" Binding="{tsfBinding:Column Path=Acronym}"/>
                <sdk:DataGridTextColumn Header="Name" Width="*" Binding="{tsfBinding:Column Path=Name}" CellStyle="{StaticResource CenterAlignCellStyle}" />
                <sdk:DataGridTextColumn Header="Type" Width="*" Binding="{tsfBinding:Column Path=Type}" CellStyle="{StaticResource CenterAlignCellStyle}"/>
                <sdk:DataGridTextColumn Header="Load Order" Width="*" Binding="{tsfBinding:Column Path=LoadOrder}" CellStyle="{StaticResource CenterAlignCellStyle}"/>
            </sdk:DataGrid.Columns>
        </sdk:DataGrid>

        <uc:DataPagerUserControl CurrentPageNumber="{Binding CurrentPageNumber}" PageCount="{Binding PageCount}"
                                 FirstCommand="{Binding FirstCommand}" PreviousCommand="{Binding PreviousCommand}"
                                 NextCommand="{Binding NextCommand}" LastCommand="{Binding LastCommand}"/>
    </StackPanel>
</UserControl>
